package com.alexrnl.BetaSeriesFileManager.API.entities.enums;

import com.alexrnl.BetaSeriesFileManager.API.entities.Subtitle;

/**
 * Enumeration representing the source of the {@link Subtitle subtitles}.
 * @author Alex
 */
public enum SubtitleSource {
	/**
	 * http://www.addic7ed.com/
	 */
	ADDIC7TED ("addic7ed"),

	/**
	 * http://www.seriessub.com/
	 */
	SERIESSUBS ("seriessub"),

	/**
	 * http://www.tvsubtitles.net/
	 */
	TVSUBTITLES ("tvsubtitles"),

	/**
	 * http://www.u-sub.net/
	 */
	USUB ("usub"),

	/**
	 * http://www.sous-titres.eu/
	 */
	SOUSTITRESEU ("soustitreeu"),

	/**
	 * Default source (generally, uploaded directly from BetaSeries).
	 */
	DEFAULT ("soustitres");

	private String	source;

	/**
	 * Constructor.
	 * @param source
	 *            the source of the {@link Subtitle}.
	 */
	private SubtitleSource (final String source) {
		this.source = source;
	}

	/**
	 * @return the source.
	 */
	public String getSource () {
		return source;
	}

	/**
	 * Retrieve a {@link SubtitleSource}.
	 * @param source
	 *            the source to look for.
	 * @return the matching enumeration, if it exist
	 */
	public static SubtitleSource fromName (final String source) {
		return Enum.valueOf(SubtitleSource.class, source);
	}

	/**
	 * @return the default source for the subtitles
	 */
	public static SubtitleSource getDefault () {
		return DEFAULT;
	}
}
